<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="6" :sm="8">
            <a-form-item label="姓名">
              <a-input placeholder="请输入姓名" v-model="queryParam.name"></a-input>
            </a-form-item>
          </a-col>
          <a-col :md="6" :sm="8">
            <a-form-item label="预警类型">
              <a-select placeholder="请选择" default-value="0" v-model="queryParam.type">
                <a-select-option value>全部</a-select-option>
                <a-select-option value="1">体温</a-select-option>
                <a-select-option value="2">心率</a-select-option>
                <a-select-option value="3">BMI</a-select-option>
                <a-select-option value="4">血氧</a-select-option>
                <a-select-option value="5">血压</a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :sm="24">
            <span style="float: right;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button
                type="primary"
                @click="searchReset"
                icon="reload"
                style="margin-left: 8px"
              >重置</a-button>
            </span>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :loading="loading"
        :pagination="ipagination"
        @change="handleTableChange"
      ></a-table>
    </div>
    <!-- table区域-end -->

  </a-card>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  name: 'WarningList',
  mixins: [JeecgListMixin],
  components: {
  },
  data() {
    return {
      description: '预警管理',
      // 表头
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 80,
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '姓名',
          dataIndex: 'xingMing',
          align: 'center'
        },
        {
          title: '性别',
          dataIndex: 'sex',
          align: 'center',
          customRender: function(t, r, index) {
            if (r.sex == 1) {
              return '男'
            } else {
              return '女'
            }
          }
        },
        {
          title: '预警时间',
          dataIndex: 'ceLiangShiJian',
          align: 'center'
        },
        {
          title: '预警类型',
          dataIndex: 'type',
          align: 'center',
          customRender: function(t, r, index) {
            switch (r.type) {
              case 1:
                return '体温'
                break
              case 2:
                return '心率'
                break
              case 3:
                return 'BMI'
                break
              case 4:
                return '血氧'
                break
              case 5:
                return '血压'
                break
            }
          }
        }
      ],
      url: {
        list: '/indicatorsAlarm/warning'
      }
    }
  },
  computed: {}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>